Repository navigation
fix(fields): after a same-edit currency change, a pick's amounts stay and their notes follow the new currency - #37284
Conversation
Claude-Session: https://claude.ai/code/session_01QSeKYnagJvGbCtNg2PhvgW Co-authored-by: Claude <noreply@anthropic.com>
…shes the notes Claude-Session: https://claude.ai/code/session_01QSeKYnagJvGbCtNg2PhvgW Co-authored-by: Claude <noreply@anthropic.com>
…opied amount Claude-Session: https://claude.ai/code/session_01QSeKYnagJvGbCtNg2PhvgW Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-justin · session_01QSeKYnagJvGbCtNg2PhvgW Final green head for the delta L1 and same-head contract review (2026-11-25T13:22Z):
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Contract reviewServed-tier: Face: declaration ( ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — REWORK · L1 · head
|
…ield before a pick again Claude-Session: https://claude.ai/code/session_01QSeKYnagJvGbCtNg2PhvgW Co-authored-by: Claude <noreply@anthropic.com>
…does Claude-Session: https://claude.ai/code/session_01QSeKYnagJvGbCtNg2PhvgW Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-justin · session_01QSeKYnagJvGbCtNg2PhvgW Final green head for the delta L1 (2026-11-25T15:11Z):
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — ACCEPT · L1 · head
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Contract reviewServed-tier: Face: declaration ( ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — ACCEPT · L1 · head
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Reviewed-by: VERDICT: PASS |
|
repo:objectstack#4 · os-justin · session_01QSeKYnagJvGbCtNg2PhvgW Landing (2026-11-25T15:52Z): head
There is no narrowing arm, so no maintainer gate applies. The optional nits N3, N5 and N6 are not taken. State change: ready for review, and auto-merge armed; the merge queue lands it. On MERGED, #36412 closes by |
repo:objectstack#4 · os-justin · session_01QSeKYnagJvGbCtNg2PhvgW
Fixes #36412
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
What changes
The ruling item on this card (comment 7118795825, 「保留金额并提示」) and its branch B (comment 7158109013), on both hosts: the line-item grid (
GridFieldWidget) and the record form (LookupFieldwith the declared pairs). Scope is bounded by ADR-0144 D2: new records, records with no saved lines, lines staged in the same edit, and declared pairs on the record's own amounts. Items 1–4 landed in #36918. With this PR the card's last open item is done.main(057cedfa9b6): nothing writes an amount when the code changes. The new pins were run against main's source files, and every amount assertion passed there; the only failures were the note lines that come after them (see Tests). Pinned either way, on both hosts. This PR adds no write.judgePickWritesnow records each amount it copies asCopiedAutofill(target,source,value,under: the code the target was in at the write). The plan gains the optionalcopied, absent when there is none. Each host keeps these beside the withheld values of the same pick. When drawing, it shows "Unit Price was copied as $100.00, but the record is now in EUR. Enter Unit Price in EUR if it should change." only when all of these hold (copiedAutofillNow): the field still holds that pick, the target still holds the copied value, and the code the target is in now is known and differs fromunder. A currency change back ends the note.withheldAutofillNowjudges each shown withheld item again withcrossCurrencyRefusal, using the picked amount's own currency (itsfrom) against the target's currency as it is now. The note follows the new code, and its reason too: a code cleared reads "no currency is chosen".nowSameCurrency, the note stays and the cell stays empty: "Unit Price was not filled when it was picked. The record is now in USD: pick again to fill $100.00." A pick again fills it (pinned as the control on the record form). When the target still holds an earlier value (held), the sentence says to clear the field, then pick again (lookup.autofillNowSameCurrencyHeld, round 3).gridAutofillCurrencyon the current line, withcolumnCurrencies(a header-following line) orcolumnFields(the line's own code). On the record form it iscurrencyForon the live record, followed parent included. So a code written later in the edit is read exactly as a pick would read it.lookup.autofillNowSameCurrency,lookup.autofillNowSameCurrencyHeldandlookup.autofillCopiedUnder, in all 11 packs (zh-Hant generated bygen:zh-hant) and inFIELD_DEFAULTS..changeset/36412-currency-change-notes.md:@object-ui/fieldsand@object-ui/i18n, bothpatch. The fix(fields): a pick says why it kept a filled amount, the opening fill stops waiting on an unreadable parent, and a code-plus-amount pick copies both #36918 changeset is left untouched.@object-ui/plugin-formchanges in its test file only, which is not published.Clause-② rework: route (a),
copiedoptionalAt the seat's rework the first declaration,
Clause-②: no, did not hold. Route (a) is taken; no route (b), nothing here needscopiedto be required.LookupAutofillPlan.copiedis now optional (copied?: CopiedAutofill[]).judgePickWritesleaves it out when the pick copied no amount under a judged currency, and every in-package reader treats absent as none (LookupField's twonoteWithheldcalls,GridFieldWidget's pick,planLookupAutofill's pass-through). A plan built withoutcopiedis still a plan, so nothing is narrowed. The published@object-ui/fieldssurface widens:withheldAutofillNow,copiedAutofillNow,copiedAutofillMessageand the typeCopiedAutofill;LookupAutofillPlan.copied;WithheldAutofill.reasonunion gainsnowSameCurrency, so code that switches over every reason gains one case.The same declaration is in the changeset.
Metadata-protocol: nonestands: no spec key, value or metadata type changes. A pin asserts that a plan which copied no amount carries nocopied.Tests
Round 3 (the seat's S1, N1, N2 and N4), all under
os-verify-lock:dd0ebf7f96: Tests 71 passed (71). Two new pins hold the held branch B case on each host (grid: header USD over a line holding 80, then EUR; form: anoverwrite: truepair over a typed 80 on a EUR quote, then USD). Each asserts the exact clear-then-pick-again sentence and that the earlier value stays. The grid branch B pin now ends with the N4 control: a pick again fills 100 and no note remains.withheldAutofillMessageis deleted (ablation-replace --delete, restored to the HEAD blob848e5fd1844c). Tests 2 failed, 9 passed: exactly the two held pins fail. The non-held branch B pins on both hosts stay green, so their wording is unchanged.dd0ebf7f96failed one test,all-locales-key-parity"placeholders match en in every pack": the first zh-Hans text of the new key named{{field}}three times against en's two, and zh-Hant was generated from it. Fixed in315c0d8fef. At that head,packages/i18n/gives Test Files 111 passed, Tests 2028 passed, 13 skipped. Only locale strings changed between the two heads; fields and plugin-form were green atdd0ebf7f96(685 of 687 files passed, 1 skipped, and the one failure was that i18n test).type-checkof the three packages exits 0 at315c0d8fef.Round 2 (the Clause-② rework), head
a602513471, all underos-verify-lock: the same three-package run gives Test Files 686 passed, 1 skipped (687), and Tests 9840 passed, 21 skipped (9861),VERDICT command-exit 0.type-checkof the three packages exits 0. Ablations of the reworked lines, each restored to the HEAD blobe96dadd3fbba:copiedalways present (return copiedAmounts.length > 0 ? { ...plan, copied: copiedAmounts } : plan;becomesreturn { ...plan, copied: copiedAmounts };): Tests 1 failed, 8 passed. The absent-means-none pin fails.Round 1 readings follow. Tests on head
482148532, all underos-verify-lock:pnpm --dir ui exec vitest run --maxWorkers=2 packages/fields/ packages/plugin-form/ packages/i18n/gives Test Files 686 passed, 1 skipped (687), and Tests 9840 passed, 21 skipped (9861),VERDICT command-exit 0.type-checkof@object-ui/fields,@object-ui/plugin-formand@object-ui/i18nexits 0, after the closure build. Both pin files are in thetsconfig.test.jsonprogram (--listFiles: 1 hit each).New pins, the point 1 measurement, and ablations
ObjectForm.lookupAutofill-28245.test.tsx, new describe "a same-edit currency change keeps amounts and says so", 4 tests throughObjectForm. (1) A USD quote picks a $100 product. Changed to EUR, it keeps 100 and shows the copied note with its exact text. Control: before the change there is no note, and changing back to USD ends it. (2) A JPY quote's withheld note names GBP and no longer JPY after the code becomes GBP, and the price stays empty. (3) Branch B: a EUR quote's withheld note reads exactly "Unit Price was not filled when it was picked. The record is now in USD: pick again to fill $100.00." once the code becomes USD, and the price stays empty. Control: the pick again fills 100 and no note remains. (4) A typed 55 gets no note through a currency change, and neither does 55 typed over a copied 100.GridField.lookupAutofill-28245.test.tsx, new describe of the same name, 5 tests. The same four cases throughGridField, with the header currency handed in ascolumnCurrenciesand changed by a rerender, for a product priced in EUR. One more is pure:withheldAutofillNowfollows the currency now,nowSameCurrencyapplies when it matches, and with no currency known the item is returned unchanged;copiedAutofillNownames a differing code only while the target holds the copied value. The Cross-currency pick follow-ups: no note on a re-pick over a filled cell, an unbounded opening wait, record forms outside the gate, and a code-plus-amount pick #36412 declared-pairs pin now also assertscopied(the price is recorded under the code the same pick wrote).057cedfa9b6in the tree only, the-t rulingpins were run, and the files were restored withgit checkout HEAD(git diff HEADempty afterwards). Result: 7 failed, 2 passed. The two hand-typed pins passed. Both copied-amount pins failed on the note line after their amount assertion (ObjectForm line 745, GridField line 641): the amount kept its value through the currency change on main. The refresh and branch B pins failed on their note text, and the pure pin failed on the missing export. Point 1 has no implementing line to ablate: nothing writes an amount on a currency change, before or after this PR.scripts/ablation-replace.mjs(lookupAutofill.ts; vitest aliases@object-ui/*tosrc, so nodistsits between mutation and run),-t ruling, each restored to the HEAD blob18535d11faef:if (!now) return item;becomesreturn item;(no refresh): Tests 5 failed, 4 passed. Refresh and branch B on both hosts, plus the pure pin.return to && to !== item.under ? to : undefined;becomesreturn undefined;(no copied note): Tests 3 failed, 6 passed. Copied note on both hosts, plus the pure pin.if (!sameValue(current, item.value) || !now) return undefined;becomesif (!now) return undefined;(a typed-over amount keeps the note): Tests 3 failed, 6 passed. Hand-typed on both hosts, plus the pure pin.Acceptance notes
yes (widening)(see the rework section above). The diff touches nopackages/spec/**and no metadata.git grepfindsLookupAutofillPlanonly insideui/packages/fields.held(a pick over a target that still holds an earlier value) now gets its own branch B sentence,lookup.autofillNowSameCurrencyHeld: "Unit Price was not filled when it was picked and still holds its earlier value. The record is now in USD: clear Unit Price, then pick again to fill $100.00." For a declared pair withoutoverwrite, picking the same record again does not replace a value that record did not fill (the spec's overwrite rule), so the sentence says to clear the field first. Re-pick behaviour is unchanged.Verification
Gates
dispatch-gates --commandsderived the same 41 at315c0d8fef. All 41 ran with exit 0, including the uiscripts/family (172 files passed, 2 skipped; 5130 tests passed).--ran: 41 derived, 41 run, 0 NOT-MEASURED, 0 UNRUN. uicheck:i18n-keys,check:i18n-drift,check:i18n-dead-keysandcheck:new-line-citationsexit 0 (run atdd0ebf7f96; the later commit changes two locale strings, and key parity is pinned by the i18n suite above). Size: 19 files, +582/-38 (620 changed lines); with fix(fields): a pick says why it kept a filled amount, the opening fill stops waiting on an unreadable parent, and a code-plus-amount pick copies both #36918's 714 the card totals 1,334, under 3,000.dispatch-gates --commandsderived the same 41 ata602513471. All 41 ran with exit 0, including the uiscripts/family (172 files passed, 2 skipped; 5130 tests passed).--ran: 41 derived, 41 run, 0 NOT-MEASURED, 0 UNRUN.dispatch-gates --commands(no paths, change set from the merge base) derived 41 commands at482148532. All 41 ran with exit 0.pnpm --dir ui exec vitest run scripts/ran under the lock with--maxWorkers=2: Test Files 172 passed, 2 skipped, and Tests 5130 passed, 2 skipped.dispatch-gates --ranwith exit codes recorded: 41 derived, 41 run, 0 NOT-MEASURED, 0 UNRUN, exit 0.check:i18n-keys,check:i18n-drift,check:i18n-dead-keysandcheck:new-line-citations: exit 0, with 0 new citations.overlap-checkbefore each push: VERDICT clean, exit 0. Re-read aftergit fetchagainstorigin/main622f3985feand 5 PR heads that share files (fix(console): a partly failed bulk approve names each failed row with its reason #37282, fix(app-shell)!: Home no longer offers Build with AI or Build an app #37249, feat(studio): open Studio's dashboards and reports in the app's edit state; × returns to the list #37226, feat(ai): get_record_context joins the service-ai platform tool group, with its chat label (ADR-0160 row 9) #37210, feat(studio): remove the Studio home; /studio opens the last package or Setup > Packages #37166): clean.--pr=37264named explicitly: merges cleanly.Read first, by risk: (1)
judgeCopy,withheldAutofillNowandcopiedAutofillNowinlookupAutofill.ts; (2) the note block at the end ofLookupField.tsx(pickStands,currencyNow); (3) the per-row note block inGridFieldWidget.tsx(lineCurrencyNow).Two-minute check:
pnpm --dir ui exec vitest run packages/plugin-form/src/ObjectForm.lookupAutofill-28245.test.tsx -t rulingpasses 4 tests. In them, a USD quote picks a $100 product, changes its currency to EUR, keeps 100, and shows "Unit Price was copied as $100.00, but the record is now in EUR."https://claude.ai/code/session_01QSeKYnagJvGbCtNg2PhvgW
🤖 Generated with Claude Code
Generated by Claude Code